package com.iwayin.web.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.iwayin.core.dataobject.UserDO;
import com.iwayin.web.common.WebConstants;
import com.opensymphony.xwork2.ActionSupport;

/**
 * action基类
 * 
 * @author xiaobo.feng<xiaobo.feng@foxmail.com>
 * 
 *         2011-8-9
 */
public class BaseAction extends ActionSupport implements SessionAware {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2397912816290473661L;

	@SuppressWarnings("rawtypes")
	protected Map session;

	@SuppressWarnings("rawtypes")
	@Override
	public void setSession(Map session) {
		this.session = session;
	}

	/**
	 * 返回登录用户
	 * 
	 * @return
	 */
	public UserDO getLoginUser() {
		return (UserDO) session.get(WebConstants.LOGIN_USER);
	}
	
	@SuppressWarnings("unchecked")
	public void setLoginUser(UserDO user){
		session.put(WebConstants.LOGIN_USER, user);
	}
}
